import * as api from '../utils/api'

function setToken(token) {
  window.localStorage.setItem(api.TOKEN_KEY, token);
  window.sessionStorage.setItem(api.TOKEN_KEY, token);
}

function clearToken() {
  localStorage.removeItem(api.TOKEN_KEY);
  sessionStorage.removeItem(api.TOKEN_KEY);
}

function getToken() {
  return localStorage.getItem(api.TOKEN_KEY);
}

var obj = {
  setToken: setToken,
  getToken:getToken,
  clearToken:clearToken
};
export default obj;
